Ccay.Module.define("Ccay.example.ui.bar",function(page,$S){
	page.ready=function(){
		/**
		 * setTimeout 延迟加载 0 就是0秒  用延迟加载的原因就是避免加载发生冲突
		 */
		setTimeout(function(){$("#barDemo").ccayTab()}, 111);
		
		$('#chart').chart({
			type:"bar",
			lines:[{label: '月度利润',xField:'month',yField:'profit'},
			       {label: '月度销售额',xField:'month',yField:'total'}
			],
			linesOp:{
				align:'center'
			},
			ajax:{
				url : 'ccay/example/ui/chart/datas2.json'
			},
			settings:{
				xaxis:{
				mode:"time",
				min: (new Date(1990, 1, 1)),
                max: (new Date(2000, 1, 1))}
			}
		});
		$('#chart1').chart({
			  type:"bar",
			  height:500,
				lines:[{label: '月度利润',xField:'profit',yField:'month'},
					       {label: '月度销售额',xField:'total',yField:'month'}
				],
				linesOp:{
					horizontal:true,
					barWidth:0.6
				},
				settings:{
					yaxis:{tickSize:1,min:1,max:12},
					xaxis:{tickSize:2500}
				},
				ajax:{
					url:'ccay/example/ui/chart/datas2.json'
				}
		});
		$('#chart3').chart({
			type:"bar",
			lines:[{label: '年份',xField:'time',yField:'total'}
			],
			linesOp:{
				align:'center'
			},
			ajax:{
				url : 'ccay/example/ui/chart/datas4timexaxis.json'
			},
			settings:{
				xaxis:{
					mode:"time",
					min:(new Date(1989, 1, 1)).getTime(),
					max:(new Date(1999, 1, 1)).getTime()
				}
			}
		});

	};
	
	function dateFormatter(v, axis) {
       return v+"月";
    }
});